package com.cy.pj.sys.service.impl;

import com.cy.pj.sys.dao.SysNoticeDao;
import com.cy.pj.sys.pojo.SysNotice;
import com.cy.pj.sys.service.SysNoticeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysNoticeServiceImpl implements SysNoticeService {
    private static final Logger logger= LoggerFactory.getLogger(SysNoticeServiceImpl.class);

    @Autowired
    private SysNoticeDao sysNoticeDao;

    @Override
    public int saveNotice(SysNotice notice) {
        int rows=sysNoticeDao.insertNotice(notice);
        return rows;
    }

    @Override
    public List<SysNotice> findNotices(SysNotice notice) {
        logger.debug("start:{}",System.currentTimeMillis());
        List<SysNotice> list=sysNoticeDao.selectNotices(notice);
        logger.debug("end:{}",System.currentTimeMillis());

        return list;
    }

    @Override
    public int deleteById(Long... ids) {
        int rows=sysNoticeDao.deleteNotice(ids);
        return rows;
    }

    @Override
    public SysNotice findById(Long id) {
        SysNotice notice=sysNoticeDao.selectById(id);
        return null;
    }

    @Override
    public int updateNotice(SysNotice notice) {
        int rows=sysNoticeDao.updateNotice(notice);
        return rows;
    }
}
